<template>
  <div class="formSelect">
    <el-select v-model="value" :multiple='!comData.node.isRadio' :placeholder="placeholder" filterable clearable
      @change='getValue'>
      <el-option v-for="item in comData.node.options" :key="item.value" :label="item.label" :value="item.value">
      </el-option>
    </el-select>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        value: '',
        obj:{}
      }
    },
    props: {
      label: [String, Number],
      placeholder: {
        type: String,
        default: ''
      },
      comData: {
        type: Object,
        default: () => ({})
      }
    },
    mounted() {
      const {node,i_key,name,type} = this.comData
      this.value = node.default
      this.obj[i_key] = node.default
      this.obj.key = i_key
      this.obj.chineseName = name
      this.obj.type = type
    },
    methods: {
      getValue() {
        this.obj[this.comData.i_key] = this.value
      },
      editValue(fieldValue){
          this.value = fieldValue
          this.getValue()
      }
    }
  }
</script>